using UnityEngine;

namespace Naptime.Extensions
{
	public static class ComponentExtensions
	{
		public static bool TryGetComponents<T>(this GameObject gameObject, out T[] components)
		{
			components = gameObject.GetComponents<T>();
			T[] array = components;
			if (array != null)
			{
				return array.Length > 0;
			}
			return false;
		}

		public static bool TryGetComponents<T>(this Component component, out T[] components)
		{
			components = component.gameObject.GetComponents<T>();
			T[] array = components;
			if (array != null)
			{
				return array.Length > 0;
			}
			return false;
		}
	}
}
